﻿# encoding:utf-8
# 分析用户功能

from db.wxpyDbBase import *
from db.wxpyDbUser import *
from sqlalchemy import create_engine
import pandas as pd
        
def analyUser():
    engine = create_engine('mysql+pymysql://root:0026888@localhost:3306/wxpy')
    sql = "select * from user_all u WHERE u.is_group=0 AND u.sex <> 0 ORDER BY u.update_time DESC "
    rocksVMines = pd.read_sql_query(sql, engine)
    logInfo('userall: '+ str(rocksVMines.shape))

    for i in range(rocksVMines.shape[0]):
        if rocksVMines.iat[i,21] == 2:
            pcolor = "red"
        else:
            pcolor = "blue"

        #plot rows of data as if they were series data
        dataRow = rocksVMines.iloc[i,0:rocksVMines.shape[1]]
        dataRow.plot(color=pcolor, alpha=0.5)

    plot.xlabel("Attribute Index")
    plot.ylabel(("Attribute Values"))
    plot.show()